<template>
  <div><el-table
    :data="tableData"
    style="width: 100%"
    :row-class-name="tableRowClassName">
    <el-table-column
      prop="date"
      label="日期"
      width="180">
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名"
      width="180">
    </el-table-column>
    <el-table-column
      prop="address"
      label="地址">
    </el-table-column>
  </el-table>
  
  <div>
 <el-switch v-model="value">
 </el-switch>
 <el-pagination
  :hide-on-single-page="value"
  :total="5"
  layout="prev, pager, next">
</el-pagination>
</div>
</div>
</template>

<style>
  .el-table .warning-row {
    background: oldlace;
  }

  .el-table .success-row {
    background: #f0f9eb;
  }
</style>

<script>
  export default {
    methods: {
      tableRowClassName({rowIndex}) {
        if (rowIndex === 1) {
          return 'warning-row';
        } else if (rowIndex === 3) {
          return 'success-row';
        }
        return '';
      }
    },
    data() {
      return {
        tableData: [{
          date: '2022-03-23',
          name: '祝阳菲',
          address: '重庆邮电大学',
        }, {
          date: '2022-3-23',
          name: '祝阳菲',
          address: '重庆邮电大学'
        }, {
          date: '2022-03-23',
          name: '祝阳菲',
          address: '重庆邮电大学',
        }, {
          date: '2022-03-23',
          name: '祝阳菲',
          address: '重庆邮电大学'
        }]
      }
    }
  }
</script>


<script>
  export default {
    data() {
      return {
        value: false
      }
    }
  }
</script>